package com.csdj.sc.comsumer.service;

import com.csdj.sc.common.entity.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class UserServiceFallbackFactory implements FallbackFactory<IUserService> {

    private Logger log = LoggerFactory.getLogger("fallback");
    @Override
    public IUserService create(Throwable cause) {
        log.error(cause.getMessage(),cause);
       return new IUserService() {
           @Override
           public List<User> list() {
               return new ArrayList<>();
           }

           @Override
           public User getById(int id) {
               return null;
           }

           @Override
           public User getByPath(int id) {
               return null;
           }

           @Override
           public User post(User user) {
               return null;
           }
       };
    }
}
